Suppose I have the class:
template<typename T>
class ChartData {
public:
...
Now I want to check if the object value
is a ChartData object:
if (value.type() == typeid(ChartData*))
However this causes the error
argument list for class template is missing
So the compiler is expecting me to put a type at ChartData*
however in this condition I'm not interested in the type - I just want to know if the object is a instance of a ChartData object.
Is this possible? If so, how?
Igor Tandetnik :
Something along these lines:\n\ntemplate <typename T>\nstruct IsChartData : public std::false_type {};\n\ntemplate <typename T>\nstruct IsChartData<ChartData<T>> : public std::true_type {};\n\nif (IsChartData<decltype(value)>()) {...}\n",
2020-02-23T17:38:29